// pages/order/order.js
const app = getApp()

Component({
  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    userId: '',
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    Custom: app.globalData.Custom,
    imageURL: 'https://p1.meituan.net/movie/68918b154fafec59990ef08d4eca86b26457115.jpg@218w_300h_1e_1c',
    Orders: [],
  },

  /**
   * 组件的方法列表
   */
  methods: {
    todetail(event){      
      wx.navigateTo({
        url: '/pages/order/detail/detail?detail='+JSON.stringify(event.currentTarget.dataset.detail),
      })
      
    }

  },
  attached: function () {
    var page=this;
    wx.getStorage({
      key: 'userInfo',
      success(res) {
        page.setData({
          userId: res.data.id
        })
        wx.request({
          url: app.globalData.url+'/wechatapi/myorders?Rid='+res.data.id,
          success(res){            
            page.setData({
              Orders: res.data
            })            
          }
        })
      }
    })
    
  }
})